package com.easylinkin.linkappapi.crane.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easylinkin.linkappapi.crane.entity.CraneBusinessRecord;
import java.util.Date;
import org.apache.ibatis.annotations.Param;

/**
 * 吊机业务数据记录表 Mapper 接口
 *
 * @author xy
 * @since 2025-06-23
 */
public interface CraneBusinessRecordMapper extends BaseMapper<CraneBusinessRecord> {
    IPage<CraneBusinessRecord> findPage(Page page, @Param("customQueryParams") CraneBusinessRecord customQueryParams);

    Double sumWeightByDay(@Param("tenantId") String tenantId, @Param("mechanicalId") String mechanicalId, @Param("day") Date day);

    Long countMinHoistingTimesByDay(@Param("tenantId") String tenantId, @Param("mechanicalId") String mechanicalId, @Param("day") Date day);

    Long countMaxHoistingTimesByDay(@Param("tenantId") String tenantId, @Param("mechanicalId") String mechanicalId, @Param("day") Date day);

    /**
     * 查询总吊重
     * @param tenantId 租户ID
     * @param mechanicalId 机械ID
     * @return 总吊重
     */
    Double getTotalWeight(@Param("tenantId") String tenantId, @Param("mechanicalId") String mechanicalId);

    /**
     * 查询总次数
     * @param tenantId 租户ID
     * @param mechanicalId 机械ID
     * @return 总次数
     */
    Long getTotalHoistingTimes(@Param("tenantId") String tenantId, @Param("mechanicalId") String mechanicalId);
}